<%@ page import="com.mastercard.CreditCard" %>



<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'expiryDate', 'error')} ">
	<label for="expiryDate">
		<g:message code="creditCard.expiryDate.label" default="Expiry Date" />
		
	</label>
	<g:datePicker name="expiryDate" precision="day"  value="${creditCardInstance?.expiryDate}" default="none" noSelection="['': '']" />
</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'bank', 'error')} required">
	<label for="bank">
		<g:message code="creditCard.bank.label" default="Bank" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="bank" name="bank.id" from="${com.mastercard.Bank.list()}" optionKey="id" required="" value="${creditCardInstance?.bank?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'budgets', 'error')} ">
	<label for="budgets">
		<g:message code="creditCard.budgets.label" default="Budgets" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${creditCardInstance?.budgets?}" var="b">
    <li><g:link controller="budget" action="show" id="${b.id}">${b?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="budget" action="create" params="['creditCard.id': creditCardInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'budget.label', default: 'Budget')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'cardName', 'error')} ">
	<label for="cardName">
		<g:message code="creditCard.cardName.label" default="Card Name" />
		
	</label>
	<g:textField name="cardName" value="${creditCardInstance?.cardName}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'ccv2', 'error')} ">
	<label for="ccv2">
		<g:message code="creditCard.ccv2.label" default="Ccv2" />
		
	</label>
	<g:textField name="ccv2" value="${creditCardInstance?.ccv2}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'nameOnCard', 'error')} ">
	<label for="nameOnCard">
		<g:message code="creditCard.nameOnCard.label" default="Name On Card" />
		
	</label>
	<g:textField name="nameOnCard" value="${creditCardInstance?.nameOnCard}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'number', 'error')} ">
	<label for="number">
		<g:message code="creditCard.number.label" default="Number" />
		
	</label>
	<g:textField name="number" value="${creditCardInstance?.number}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'transactions', 'error')} ">
	<label for="transactions">
		<g:message code="creditCard.transactions.label" default="Transactions" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${creditCardInstance?.transactions?}" var="t">
    <li><g:link controller="transaction" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="transaction" action="create" params="['creditCard.id': creditCardInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'transaction.label', default: 'Transaction')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: creditCardInstance, field: 'user', 'error')} required">
	<label for="user">
		<g:message code="creditCard.user.label" default="User" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="user" name="user.id" from="${com.mastercard.auth.User.list()}" optionKey="id" required="" value="${creditCardInstance?.user?.id}" class="many-to-one"/>
</div>

